<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>职业路径管理</title>
    <!--<link href="__CSS__/bootstrap.min.css?v=3.3.6" rel="stylesheet">-->
    <!--<link href="__CSS__/font-awesome.css?v=4.4.0" rel="stylesheet">-->


    <!--<link href="__CSS__/animate.css" rel="stylesheet">-->
    <!--<link href="__CSS__/style.css?v=4.1.0" rel="stylesheet">-->
    <!--<script src="http://static.runoob.com/assets/jquery-validation-1.14.0/lib/jquery.js"></script>-->
    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="https://cdn.bootcss.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css">
    <script src="https://cdn.bootcss.com/jquery/2.1.1/jquery.min.js"></script>
    <script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<div><h1>职业路径页面管理</h1></div>

<div class="row">
    <a class=" col-sm-4 col-xs-4 col-sm-offset-4 col-xs-offset-4 btn btn-lg btn-danger" href="{:url('Occupation/add_picture')}">
       添加
    </a>
    <br>
    <table class="table table-hover table-bordered text-center">
        <thead >
        <tr >
            <th class="text-center">id</th>
            <th class="text-center">图片</th>
            <th class="text-center">名字</th>
            <th class="text-center">管理操作</th>
        </tr>
        </thead>
        <tbody>
        {volist name="carousel" id="value"}
        <tr>
        <td class="text-center">{$value.pid}</td>
        <td class="text-center"><img src="__IMAGES__/{$value.pimg}" alt=""></td>
        <td class="text-center">{$value.pcontent}</td>
        <td class="text-center">
            <a class="btn btn-danger" href="{:url('Occupation/read')}?id={$value.pid}">查看内容</a>
            <a  class="btn btn-danger" href="{:url('Occupation/update')}?id={$value.pid}">修改</a>
            <a class="btn btn-danger"  onclick="deletes('{$value.pid}')">删除</a>
        </td>
        </tr>
        {/volist}
        </tbody>
    </table>

</div>
</div>
<script>
   var deleteurl="{:url('Occupation/delete')}"
    function deletes(picture_id) {
        if(confirm("你确定要删除这个吗  ？！")){
            $.ajax({
                url:deleteurl,
                type:"post",
                dataType:"text",
                data:{
                    picture_id:picture_id
                },
                success:function (data) {
                    if(data=="1"){
                        alert("删除成功")
                        history.go(0)
                    }else{
                        alert("删除失败")
                    }
                },
                error:function (e) {
                    alert(e.response)
                }


            })
        }
    }
</script>


</body>
</html>